home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / prog_gen / lcms.zip / USRGUIDE.DOC (.txt) < prev   
WordStar Document  |  1994-06-09  |  39KB  |  581 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. LAUREL COBOL MAINTENANCE SUPPORT SYSTEM
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. This is a maintenance programmer's productivity improvement tool.  It makes poor to middling quality programs more legible, thus making it easier to get a handle on what they're doing, thus shortening the time it takes to implement changes and/or enhancements.
  20.  
  21.  
  22.  
  23.  
  24. Copyright (c) 1994 by David Edward Richmond. All rights reserved.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. THIS SOFTWARE AND MANUAL ARE SOLD AS IS AND WITHOUT WARRANTIES AS TO PER- FORMANCE OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE AND SOFTWARE ENVIRONMENTS INTO WHICH THIS SYSTEM MAY BE PUT, NO WARRANTY OF FITNESS IS OFFERED.
  31.  
  32.  
  33. With the foregoing disclaimer out of the way, be advised that the System has been in use for several years with no known bugs, but it should be viewed as a computer assisted source program reiteration tool rather than a do it all product.  A given source program may have to be run through the System several times, with various control table changes, before the user is fully satisfied with the results.
  34.   
  35.                                 F O R W A R D
  36.  
  37. This product is designed to lighten the program maintenance burden by improving program legibility before changes are applied. Illegible programs are difficult to upgrade.
  38.  
  39. Illegibility stems from poor organization, cryptic abbreviations, sequencing schemes that have collapsed over a period of time, and multiple coding styles, to name the major causes - and the LCMS System can fix them.
  40.  
  41. The System is not a _Restructuring Engine_ in that it doesn't add code or change the logic of what is present - but it does reiterate the source program by applying various literary standards that will improve legibility anywhere from a modest to a remarkable degree, depending upon the original condition.
  42.  
  43. Experience has shown that this improved legibility often halves the time it takes to make a significant modification or upgrade to an average program.
  44.  
  45. The System has also proven useful in new program development, permitting the programmer an otherwise forbidden "quick & dirty" approach that can be cor- rected by a final-step recomposition; and especially useful in Assembler to COBOL conversions, allowing the programmer to employ as close to a one-for-one reiteration as the two languages permit - with a final-step recomposition thru the LCMS System to clean everything up.
  46.                            I N T R O D U C T I O N
  47.  
  48. Perhaps one can't apply a scientific definition to the term Literary Standards but it's obvious to all that there's a difference between the works of Shakespear and those of the old pulp western authors, just as there's a difference in the organization of college text books and those produced for the grade school student.
  49.  
  50. Computer programs can be viewed as literary products too; differently structured because they're written for both people and computers - but they're not all that remote from the mainstream that similar literary standards can't be applied to them.  Literary standards should be applied to them.
  51.  
  52. As an example, consider the following:
  53.  
  54.                                 --- BEFORE ---
  55.  
  56.        FILE-CONTROL.
  57. 00001      SELECT FILE1            ASSIGN TO TRANFILE.                  ARP910
  58. 00002      SELECT FILE2            ASSIGN TO VSAM-CUSTOMER              ARP910
  59. 00003                              ORGANIZATION IS INDEXED              ARP910
  60. 00004                              ACCESS MODE IS DIRECT                ARP910
  61. 00005                              FILE STATUS IS R2-STATUS             ARP910
  62. 00006                              RECORD KEY IS R2-RECORD-KEY.         ARP910
  63. 00007      SELECT FILE3            ASSIGN TO SYSPRINT.                  ARP910
  64.        DATA DIVISION.
  65.        FILE SECTION.
  66.        FD  FILE1 DATA RECORD IS RECORD1
  67.            RECORD CONTAINS 35 TO 100 CHARACTERS
  68.            BLOCK CONTAINS 0 RECORDS
  69.            LABEL RECORDS ARE STANDARD
  70.            RECORDING MODE IS V.
  71.        01  RECORD1, PICTURE X(100).
  72.  
  73.                                 --- AFTER ---
  74.  
  75. 000190 FILE-CONTROL.                                                    ARP910
  76. 000200                                                                  ARP910
  77. 000210     SELECT FILE1, ASSIGN TO TRANFILE.                            ARP910
  78. 000220     SELECT FILE2, ASSIGN TO VSAM-CUSTOMER,                       ARP910
  79. 000230       ORGANIZATION IS INDEXED,                                   ARP910
  80. 000240         FILE STATUS IS R2-STATUS,                                ARP910
  81. 000250           ACCESS MODE IS DIRECT,                                 ARP910
  82. 000260             RECORD KEY IS R2-RECORD-KEY.                         ARP910
  83. 000270     SELECT FILE3, ASSIGN TO SYSPRINT.                            ARP910
  84. 000280                                                                  ARP910
  85. 000290 DATA DIVISION.                                                   ARP910
  86. 000300 FILE SECTION.                                                    ARP910
  87. 000310                                                                  ARP910
  88. 000320 FD  FILE1 DATA RECORD IS RECORD1,                                ARP910
  89. 000330       RECORD CONTAINS 35 TO 100 CHARACTERS,                      ARP910
  90. 000340         BLOCK CONTAINS 0 RECORDS,                                ARP910
  91. 000350           LABEL RECORDS ARE STANDARD,                            ARP910
  92. 000360             RECORDING MODE IS V.                                 ARP910
  93. 000370  01 RECORD1, PICTURE X(100).                                     ARP910
  94. 000380                                                                  ARP910                            RECOMPOSITION EXAMPLES
  95.  
  96.                                 --- BEFORE ---
  97.  
  98. 000870 01  NUMERIC-CONVERSION-FIELDS.
  99. 000880     03  NCF-1.
  100. 000890         07  NCF-1A, PICTURE XXXX.
  101. 000900           07  NCF-1B, PICTURE S9, COMP-3, VALUE ZERO.
  102. 000910     03  NCF-2 REDEFINES NCF-1.
  103. 000920        07  NCF-2A, PICTURE S9(9), COMP-3.
  104. 000930     03  NCF-3, PICTURE 9(9).
  105. 000940     03  NCF-4 REDEFINES NCF-3.
  106. 000950       04  NCF-4A, PICTURE 999.
  107. 000960         04  NCF-4B, PICTURE 9999.
  108. 000970        04 NCF-4C, PICTURE 9.
  109. 000980          04  FILLER, PICTURE X.
  110. 000990     03  NCF-5, PICTURE 9(9).
  111.    000     03 NCF-6 REDEFINES NCF-5.
  112.    010         06  NCF-6A, PICTURE 9(6).
  113.    020         06 NCF-6B, PICTURE 999.
  114.  
  115.                                 --- AFTER ---
  116.  
  117. 000840  01 NUMERIC-CONVERSION-FIELDS.                                   ARP910
  118. 000850      03 NCF-1.                                                   ARP910
  119. 000860          05 NCF-1A               PICTURE XXXX.                   ARP910
  120. 000870          05 NCF-1B               PICTURE S9, COMP-3, VALUE ZERO. ARP910
  121. 000880      03 NCF-2 REDEFINES NCF-1.                                   ARP910
  122. 000890          05 NCF-2A               PICTURE S9(9), COMP-3.          ARP910
  123. 000900      03 NCF-3                    PICTURE 9(9).                   ARP910
  124. 000910      03 NCF-4 REDEFINES NCF-3.                                   ARP910
  125. 000920          05 NCF-4A               PICTURE 999.                    ARP910
  126. 000930          05 NCF-4B               PICTURE 9999.                   ARP910
  127. 000940          05 NCF-4C               PICTURE 9.                      ARP910
  128. 000950          05 FILLER               PICTURE X.                      ARP910
  129. 000960      03 NCF-5                    PICTURE 9(9).                   ARP910
  130. 000970      03 NCF-6 REDEFINES NCF-5.                                   ARP910
  131. 000980          05 NCF-6A               PICTURE 9(6).                   ARP910
  132. 000990          05 NCF-6B               PICTURE 999.                    ARP910
  133.  
  134. The LCMS System reorganizes Data Division record layouts into five B-margin indents of 4 character positions, each, based on data level number.
  135.  
  136. Options exist for converting PICTURE to PIC or vice-versa and FILLER to FIL or vice-versa.
  137.  
  138. The PICTURE clause may abutt the data name, separated by a comma (the de- fault), or may be set to begin anywhere from columns 25 thru 45.
  139.  
  140. Comment lines will be passed as-is, but multiple spacer lines will be eliminated.  A single spacer line will be emitted ahead of each 01-level data name.
  141.    
  142.                             RECOMPOSITION EXAMPLES
  143.  
  144.                                 --- AFTER ---
  145.  
  146. 004110 2000-PROCESS-ROUTINE.                                            APXPS104
  147. 004120     IF DETAIL-MAINT-CODE = 'D'                                   APXPS104
  148. 004130         GO TO 2000-READ-NEXT.                                    APXPS104
  149. 004140     IF DETAIL-APCODE = CONTROL-PROCESSING-APCODE OR              APXPS104
  150. 004150             CONTROL-PROCESSING-APCODE = ZERO                     APXPS104
  151. 004160         NEXT SENTENCE                                            APXPS104
  152. 004170           ELSE                                                   APXPS104
  153. 004180         GO TO 2000-READ-NEXT.                                    APXPS104
  154. 004190     IF CONTROL-PROCESSING-DATE > DETAIL-PROCESS-DATE OR          APXPS104
  155. 004200             CONTROL-PROCESSING-DATE = DETAIL-PROCESS-DATE        APXPS104
  156. 004210         IF WS-FIRST-TIME-SW = 'Y'                                APXPS104
  157. 004220             MOVE DETAIL-VENDOR-NUMBER TO HOLD-VENDOR-NUMBER      APXPS104
  158. 004230             MOVE DETAIL-ACCOUNT-NUMBER TO                        APXPS104
  159. 004240                     HOLD-WHOLE-ACCOUNT-NUMBER                    APXPS104
  160. 004250             MOVE DETAIL-MATCH-CODE-NUMBER TO                     APXPS104
  161. 004260                     HOLD-MATCH-CODE-NUMBER                       APXPS104
  162. 004270             MOVE DETAIL-APCODE TO HOLD-APCODE                    APXPS104
  163. 004280             MOVE 'N' TO WS-FIRST-TIME-SW                         APXPS104
  164. 004290             PERFORM 8400-READ-GLADESC THRU 8400-EXIT             APXPS104
  165. 004300             PERFORM 8500-READ-VENDOR THRU 8500-EXIT              APXPS104
  166. 004310             PERFORM 3000-PROCESS-RECORD THRU 3000-EXIT           APXPS104
  167. 004320               ELSE                                               APXPS104
  168. 004330             PERFORM 3000-PROCESS-RECORD THRU 3000-EXIT.          APXPS104
  169.  
  170. The Procedure Division normally employs varying amounts of compound and complex sentence syntaxt.  The LCMS System attempts to separate dependent clauses into separate lines for the sake of improved legibility.
  171.  
  172. Dependent clauses begin with a COBOL reserved word (or phrase), and those that should prompt a new line at the next indent are contained in the table file INDENT1.LCS. Some of these reserved words are treated differently than others;
  173. as for example note the special treatment of the ELSE in the preceeding speci- men.  There are, in fact, nine different alogrythms for the various types of dependent clauses.  These are summarized on page 14.
  174.  
  175. If a clause can't be contained in a single line, then the continuation is given a double indent.  The preceeding specimen has three examples of this.
  176.  
  177. The first example shows the necessity of the double indent - because of the immediately following phrase.  The second and third examples might look better with only a single indent, but the LCMS System doesn't know in advance what's going to follow.  These can be manually adjusted should the user desire to do so.
  178.                             RECOMPOSITION EXAMPLES
  179.  
  180.                                 --- BEFORE ---
  181.  
  182.  00070 UPDATE-CUSTOMER-RECORD.
  183.  00080     IF CS-TRAN=CODE = SPACES GO TO S1.
  184.  00090     MOVE CHARGE-SEGMENT TO MONETARY-TRANSACTION-TABLE (1).
  185. 031000     MOVE +1 TO MONETARY-TRANSACTION-NBR-OCCURS.
  186. 031010     MOVE +2 TO SS2, GO TO S2.
  187. 031020 S1. MOVE +1 TO SS2.
  188. 031030 S2. MOVE +1 TO SS1, GO TO T2.
  189. 031040 T1. ADD +1 TO SS1.
  190.            IF SS1 IS GREATER THAN +4 GO TO T3.
  191.        T2. IF TS-TRANCODE (SS1) = SPACES GO TO T1.
  192. 031070     MOVE TRANSACTION-SEGMENT (SS1)
  193. 031080     TO MONETARY-TRANSACTION-TABLE (SS2).
  194. 031090     MOVE SS2 TO MONETARY-TRANSACTION-NBR-OCCURS.
  195. 003000     ADD +1 TO SS2, GO TO T1.
  196. 003010 T3. EXIT.
  197.  
  198.                                 --- AFTER ---
  199.  
  200. 002910                                                                  ARP910
  201. 002920 UPDATE-CUSTOMER-RECORD.                                          ARP910
  202. 002930         IF CS-TRAN=CODE = SPACES                                 ARP910
  203. 002940             GO TO TAG012.                                        ARP910
  204. 002950         MOVE CHARGE-SEGMENT TO MONETARY-TRANSACTION-TABLE (1).   ARP910
  205. 002960         MOVE +1 TO MONETARY-TRANSACTION-NBR-OCCURS.              ARP910
  206. 002970         MOVE +2 TO SS2,                                          ARP910
  207. 002980             GO TO TAG013.                                        ARP910
  208. 002990 TAG012. MOVE +1 TO SS2.                                          ARP910
  209. 003000 TAG013. MOVE +1 TO SS1,                                          ARP910
  210. 003010             GO TO TAG015.                                        ARP910
  211. 003020 TAG014. ADD +1 TO SS1.                                           ARP910
  212. 003030         IF SS1 IS GREATER THAN +4                                ARP910
  213. 003040             GO TO TAG016.                                        ARP910
  214. 003050 TAG015. IF TS-TRANCODE (SS1) = SPACES                            ARP910
  215. 003060             GO TO TAG014.                                        ARP910
  216. 003070         MOVE TRANSACTION-SEGMENT (SS1) TO                        ARP910
  217. 003080             MONETARY-TRANSACTION-TABLE (SS2).                    ARP910
  218. 003090         MOVE SS2 TO MONETARY-TRANSACTION-NBR-OCCURS.             ARP910
  219. 003100         ADD +1 TO SS2,                                           ARP910
  220. 003110             GO TO TAG014.                                        ARP910
  221. 003120 TAG016. EXIT.                                                    ARP910
  222. 003130                                                                  ARP910
  223.  
  224. Many programs don't use them, but here you see an example of a program that  employs Statement names distinct from Paragraph names. Both are Procedure names, but logically, statements, labeled or not, are part of a specific paragraph - and the LCMS System enforces a naming standard for statement labels that make their subordinant status obvious to the reader.
  225.  
  226. There are two reiteration programs. One generates 2-character statement labels in the manner shown in the before example, and the other generates 6-byte labels as seen in the after example, with a B-Margin option of either column 12 or column 16.                            RECOMPOSITION EXAMPLES
  227.  
  228.                                 --- BEFORE ---
  229.  
  230. 019840         IF TH-CODE-FTRS-LANGUAGE = 'F' AND (TH-CODE-FTRS-GTA = 'NSCC3C000
  231. 019850-            '' OR SPACES)                                        SCC3C000
  232. 019860           MOVE 'TCL-2' TO WS-PARAMETER                           SCC3C000
  233. 019870           PERFORM 67000-MOVE-PARAMETER.                          SCC3C000
  234. 019880         IF TH-CODE-FTRS-LANGUAGE = 'F' AND TH-CODE-FTRS-GTA = 'Y'SCC3C000
  235. 019890           MOVE 'TCL-9' TO WS-PARAMETER                           SCC3C000
  236. 019900           PERFORM 67000-MOVE-PARAMETER.                          SCC3C000
  237. 019910         IF TH-CODE-FTRS-CALL-FOLLOWING = 'Y'                     SCC3C000
  238. 019910         IF TH-CODE-FTRS-CALL-FOLLOWING = 'Y'                     SCC3C000
  239. 019910         IF TH-CODE-FTRS-CALL-FOLLOWING = 'Y'                     SCC3C000
  240. 019920           MOVE 'MRF-3' TO WS-PARAMETER                           SCC3C000
  241.                    ELSE
  242. 019930           PERFORM 67000-MOVE-PARAMETER                           SCC3C000
  243.                    ELSE
  244. 019930           PERFORM 67010-MOVE-PARAMETER                           SCC3C000
  245.                    ELSE
  246. 019930           PERFORM 67050-MOVE-PARAMETER.                          SCC3C000
  247. 019940         IF TH-CODE-FTRS-CALL-FORWARDING = 'Y'                    SCC3C000
  248. 019950           MOVE 'CTR-2' TO WS-PARAMETER                           SCC3C000
  249. 019960           PERFORM 67000-MOVE-PARAMETER.                          SCC3C000
  250.  
  251.                                 --- AFTER ---
  252.  
  253. 001550     IF TH-CODE-FTRS-LANGUAGE = 'F'                               SCC3C000
  254. 001560     AND (TH-CODE-FTRS-GTA = 'N' OR SPACES)                       SCC3C000
  255. 001570         MOVE 'TCL-2' TO WS-PARAMETER                             SCC3C000
  256. 001580         PERFORM 67000-MOVE-PARAMETER.                            SCC3C000
  257. 001590     IF TH-CODE-FTRS-LANGUAGE = 'F'                               SCC3C000
  258. 001600     AND TH-CODE-FTRS-GTA = 'Y'                                   SCC3C000
  259. 001610         MOVE 'TCL-9' TO WS-PARAMETER                             SCC3C000
  260. 001620         PERFORM 67000-MOVE-PARAMETER.                            SCC3C000
  261. 001630     IF TH-CODE-FTRS-CALL-FOLLOWING = 'Y'                         SCC3C000
  262. 001640         IF TH-CODE-FTRS-CALL-FOLLOWING = 'Y'                     SCC3C000
  263. 001650             IF TH-CODE-FTRS-CALL-FOLLOWING = 'Y'                 SCC3C000
  264. 001660                 MOVE 'MRF-3' TO WS-PARAMETER                     SCC3C000
  265. 001670                   ELSE                                           SCC3C000
  266. 001680                 PERFORM 67000-MOVE-PARAMETER                     SCC3C000
  267. 001690                   ELSE                                           SCC3C000
  268. 001700             PERFORM 67010-MOVE-PARAMETER                         SCC3C000
  269. 001710               ELSE                                               SCC3C000
  270. 001720         PERFORM 67050-MOVE-PARAMETER.                            SCC3C000
  271. 001730     IF TH-CODE-FTRS-CALL-FORWARDING = 'Y'                        SCC3C000
  272. 001740         MOVE 'CTR-2' TO WS-PARAMETER                             SCC3C000
  273. 001750         PERFORM 67000-MOVE-PARAMETER.                            SCC3C000
  274.  
  275.  
  276. There are multiple uses of the OR operator, and the LCMS System chooses to manipulate it as shown in the preceeding example.  Some nested IFs may have to be manually corrected, however, to get them to appear as the user wants them.
  277.  
  278. Many programmers choose to key their indent structure on the ELSE operator rather than on the operative statement that follows it, but the LCMS System feels that it should be just the opposite.
  279.  
  280. In other words, the indent is keyed to the operative statement with the ELSE tucked out of the way so as not to interfere with the reader's comprehension of the syntaxt.
  281.  
  282. The reader is reminded that COBOL is a syntaxt-oriented language translator, and it pays no attention whatever to any indent structure that may or may not be present.  Indents are for people, and whatever works best is that which should be used.
  283.    
  284.  
  285.                                 --- BEFORE ---
  286.  
  287. 021170         EXEC CICS READ DATASET('SCVTA008')                       SCC3C000
  288. 021180                            INTO (TRANSACTION-HISTORY-RECORD)     SCC3C000
  289. 021190             RIDFLD(TH-RECORD-KEY) EQUAL NOHANDLE                 SCC3C000
  290. 021200             RESP(RESPONSE-CODE) END-EXEC.                        SCC3C000
  291.  
  292.                                 --- AFTER ---
  293.  
  294. 002260     EXEC CICS READ                                               SCC3C000
  295. 002270         DATASET ('SCVTA008')                                     SCC3C000
  296. 002280         INTO (TRANSACTION-HISTORY-RECORD)                        SCC3C000
  297. 002290         RIDFLD(TH-RECORD-KEY)                                    SCC3C000
  298. 002300         EQUAL                                                    SCC3C000
  299. 002310         NOHANDLE                                                 SCC3C000
  300. 002320         RESP(RESPONSE-CODE)                                      SCC3C000
  301. 002330         END-EXEC.                                                SCC3C000
  302.  
  303.  
  304. The LCMS System reiteration programs employ two external table files for indent processing.  INDENT1 (previously described) controls the basic COBOL dependent clause recognition, and INDENT2 is to be used for whatever special handling may be appropriate for external calls to a communications monitor or data base management system, etc.
  305.  
  306. Both indent tables are supplied with the System, with INDENT2 being set up for CICS.  Table layouts are described at the end of the manual.
  307. SYSTEM OVERVIEW
  308.  
  309. Basically, the LCMS System has three operations:
  310.  
  311. (1) RELEVELRenumbers data name level numbers so that they are consistant throughout the entire Data Division.  Specification of the six low-order level numbers (beyond 01) is requested by the RELEVEL program at startup time.
  312.  
  313. (2) REPLACEReplaces cryptic abbreviations and any other data or procedure names with whatever is deemed to be more appropriate. Word replacement is controlled by a table file which must be prepared prior to REPLACE program run time.
  314.  
  315. (3) REWRITEReiterates the source program according to the literary standards and various options described before and below.
  316.  
  317. There are two reiteration programs: REWRITE1 employs a six-character statement label in the form TAGnnn with a B-Margin option of either columns 12 or 16. REWRITE2 employs a two-character statement label and a B-Margin fixed at column 12.  The statement labels run in the range A1 thru Z9, then AA thru ZZ excepting the reserved COBOL words of IF, TO, OR, etc.  A control table called LABELS is required by REWRITE2.
  318.  
  319. The following utility programs are also supplied with the System:
  320.  
  321. (1) MP021Resequences the COBOL source program and emits the program name in columns 72 thru 80 of each statement (expands trun- cated records to 80 characters).
  322.  
  323. (2) MP023Compresses 80-characrter records down to the last non-blank character (PC VBS Format).  Can save significant disk space while modifying a source program with a word processor.
  324.  
  325. Whenever a reiterated program requires one or more manual revisions to what- ever the LCMS did to it, then MP021 may be used to resequence it again.
  326.  
  327. Required control tables:
  328.  
  329. LABELSThe legal 2-character statement labels used by REWRITE2.
  330. INDENT1All the basic COBOL verbs that require continued line indents. May cover both VS COBOL and COBOL-II (and include DB2 verbs as well).
  331. INDENT2Auxilliary indent table for communications monitor or database management system, etc.  Supplied version is for CICS.
  332.  
  333. The structure of the Indent tables is described on page 14.
  334.  
  335. The word replacement table required by REPLACE is specific to each program be- ing reiterated. Its layout is Old Word beginning in column 1 followed by New Word with at least one blank separating them.
  336. R U N N I N G   T H E   S Y S T E M
  337.  
  338. Some Download software copy programs in their original 80-character format (plus the CR/LF symbols) and some truncate the records to their last non-blank character.  The LCMS System can handle either form, but it isn't designed to handle embedded tab skip symbols, such as might be emitted by a PC word processor.
  339.  
  340. Any program with embedded tab skip symbols must be passed through MP021 before it is submitted to the LCMS System.  By the same token, if the output program is retouched by a word processor it must be passed through MP021 before being uploaded.
  341.  
  342.                   RESEQUENCING DATA DEFINITION LEVEL NUMBERS
  343.  
  344. This function is required when a program has inconsistent level number assign- ments.  Given the following data definitions ...
  345.  
  346. 000750 01  BREAK-CONTROL.
  347. 000760     02  BC-MERCHANT-NBR, PICTURE 999.
  348. 000770     02  BC-CUSTOMER-NBR, PICTURE 9999.
  349. 000780     02  BC-CHECK-DIGIT, PICTURE 9.
  350. 000790
  351. 000800 01  WORKING-DATE.
  352. 000810     10  WD-CENTURY, PICTURE 99, VALUE 19.
  353. 000820     10  WD-YYMMDD.
  354. 000830         15  WD-YEAR, PICTURE 99.
  355. 000840         15  WD-MONTH, PICTURE 99.
  356. 000850         15  WD-DAY, PICTURE 99.
  357.  
  358.  ... you will note that level 02 for BREAK-CONTROL has the same relative in- dent as level 10 for WORKING-DATE.  This presents a problem for the REWRITE because it requires complete consistency throughout the entire program in level number assignments for indent selection.
  359.  
  360. Level numbers may be in the series 02, 03, 04, 05, etc., or 03, 05, 07, etc., but if they aren't all the same for all data definitions then the RELEVEL pro- gram must be used ahead of the REWRITE program.  Setup is as follows:
  361.  
  362. RELEVEL
  363. MP024 Starting
  364. Adjusts COBOL Data Definition Level Numbers
  365. Specify Input File DSNAME: C:ARP910.COB
  366. Specify Work File DSNAME: C:ARP910.WRK
  367. Specify Output File DSNAME: C:ARP910.REL
  368. Specify the lowest 6 data level-numbers beyond 01 to be used in the program
  369. by overkeying where required: 03,05,07,09,11,13
  370. MP024 Finished
  371.  
  372. The requests for DSNAMEs show specimen responses, but the message requesting data level numbers emits the most commonly used numbers.  If they are satis- factory as is, then simply press the ENTER key and RELEVEL will execute.
  373.                        REPLACING CRYPTIC ABBREVIATIONS
  374.  
  375. In addition to cryptic abbreviations the REPLACE program may be used to simply change data names and procedure names to more appropriate selections. Anything that makes a program easier to follow is appropriate.
  376.  
  377. Getting set up for a REPLACE run takes a little effort.  You must peruse the original source listing and create a word replacement table for the words that are to be changed.  You may use a word processor or the EDLIN utility. Each table record must be in the form...
  378.  
  379. OLDWORD NEWWORD
  380.  
  381.  ... each entry may be 30 characters in length, and the pair must be separated by at least one blank.  A columnar alignment for "NEWWORD" is optional, and the table does not have to be in sequence.
  382.  
  383. Setup for the REPLACE program is as follows:
  384.  
  385. REPLACE
  386. MP025 Starting
  387. COBOL Word Replacement Program
  388. Specify Single or Double Quotes (S or D): S
  389. Specify Input File DSNAME: C:ARP910.REL
  390. Specify Word Replacement Table: C:APR910.TBL
  391. Specify Output File DSNAME: C:ARP910.REP
  392. MP025 Finished
  393.  
  394. In the normal course of events, several passes by REPLACE may be necessary be- fore the replacement table covers everything you want fixed.
  395.  
  396. TSO and PC word processors have word replacement facilities, but word proces- sors don't care if they do an overset past column 72, and TSO will refuse an overset past column 72.  REPLACE will process all replacement requests, and if an overset would otherwise occur it creates a continuation line - and unlike TSO and word processors, it will not replace words occurring within a literal string.  Where such is necessary, you will have to manually process each one individually.
  397.  
  398.                        COBOL SOURCE PROGRAM REITERATION
  399.  
  400. Where a given program is to have no statement names (as distinct from para- graph names), then all procedure names must be eight characters or more in length (and even eight character names could be viewed as being cryptically abbreviated).
  401.  
  402. REWRITE1
  403. MP029 Starting
  404. Laurel COBOL Recomposition System Reiteration
  405. Specify Program Name:
  406. Specify Quote Symbol (S or D):
  407. Recompose Procedure Division Only (Y/N)?
  408. Specify the lowest 6 data level-numbers beyond 01 to be used in the program
  409. by overkeying where required: 03,05,07,09,11,13
  410. Use Short Form of FILLER (Y/N)?
  411. Use Short Form of PICTURE (Y/N)?
  412. Specify Picture Clause Margin (25-45):
  413. Specify Procedure Division B Margin (12/16):
  414. Specify Primary Indent Table DSNAME: C:INDENT1.LCS
  415. Specify Auxilliary Indent Table DSNAME: C:INDENT2.LCS
  416. Specify Input File DSNAME:
  417. Specify Workfile DSNAME: C:REWRITE.WRK
  418. Specify Output File DSNAME:
  419. So you want Statement XREF Report (Y/N)?
  420. MP029 Beginning Reiteration Run
  421. Specify XREF File DSNAME:                        [if response was Yes]
  422. MP029 Finished
  423.  
  424. Pressing the ENTER key without first keying a response to the requests for Quote Symbol and PICTURE Clause Margin will result in system defaults of "S" and no PICTURE clause indent, respectively.
  425.  
  426. Most reiteration runs require more than one pass through the System before the
  427. Procedure Division fits the required results.  Intermediate stages may be shortened by bypassing reiteration of the other divisions.
  428.  
  429. All requests for file names should be preceeded by the drive ID. If not speci-
  430. fied, the default will be assigned to drive B rather than the system disk.
  431.  
  432. All Yes/No setup requests default to No.  Predefined requests default to the values shown, unless overkeyed.
  433.  
  434. This program requires the INDENT1.LCS and INDENT2.LCS control tables.
  435.  
  436. If the program being reiterated has statement labels, then a cross-reference file may optionally be written.  If requested, it may be listed by the DOS PRINT facility.
  437.  
  438.                        COBOL SOURCE PROGRAM REITERATION
  439.  
  440.  
  441. REWRITE2
  442. MP030 Starting
  443. Laurel COBOL Recomposition System Reiteration
  444. Specify Program Name:
  445. Specify Quote Symbol (S or D):
  446. Recompose Procedure Division Only (Y/N)?
  447. Specify the lowest 6 data level-numbers beyond 01 to be used in the program
  448. by overkeying where required: 03,05,07,09,11,13
  449. Use Short Form of FILLER (Y/N)?
  450. Use Short Form of PICTURE (Y/N)?
  451. Specify Picture Clause Margin (25-45):
  452. Specify Labels File DSNAME: C:LABELS.LCS
  453. Specify Primary Indent Table DSNAME: C:INDENT1.LCS
  454. Specify Auxilliary Indent Table DSNAME: C:INDENT2.LCS
  455. Specify Input File DSNAME:
  456. Specify Workfile DSNAME: C:REWRITE.WRK
  457. Specify Output File DSNAME:
  458. So you want Statement XREF Report (Y/N)?
  459. MP030 Beginning Reiteration Run
  460. Specify XREF File DSNAME:                        [if response was Yes]
  461. MP030 Finished.
  462.  
  463. Pressing the ENTER key without first keying a response to the requests for Quote Symbol and PICTURE Clause Margin will result in system defaults of "S" and no PICTURE clause indent, respectively.
  464.  
  465. Most reiteration runs require more than one pass through the System before the
  466. Procedure Division fits the required results.  Intermediate stages may be shortened by bypassing reiteration of the other divisions.
  467.  
  468. All requests for file names should be preceeded by the drive ID. If not speci-
  469. fied, the default will be assigned to drive B rather than the system disk.
  470.  
  471. All Yes/No setup requests default to No.  Predefined requests default to the values shown, unless overkeyed.
  472.  
  473. This program requires all three control tables.
  474.  
  475. If the program being reiterated has statement labels, then a cross-reference file may optionally be written.  If requested, it may be listed by the DOS PRINT facility.
  476.  
  477.                             REWRITE ERROR MESSAGES
  478.  
  479. Preferably, the source program to be reiterated should be error free - but the REWRITE program has a limited error diagnostic facility.  When an error is de- tected, the offending source statement will be sent to the output file with the following message:
  480.  
  481.      ***ERROR CONDITION 'x' (SKIPPING REMAINDER OF INPUT PROGRAM)
  482.  
  483. Error Code Index
  484. ----------------
  485.  
  486. A = IDENTIFICATION DIVISION not found.
  487. C = INPUT-OUTPUT SECTION not followed by FILE-CONTROL or I-O CONTROL.
  488. D = FILE-CONTROL not followed by a SELECT statement.
  489. E = ENVIRONMENT DIVISION not followed by:
  490.           (1) CONFIGURATION SECTION or
  491.           (2) INPUT-OUTPUT SECTION or
  492.           (3) DATA DIVISION
  493. F = I-O-CONTROL encountered without preceeding FILE-CONTROL.
  494. G = DATA DIVISION not found.
  495. H = DATA DIVISION found but not immediately followed by:
  496.           (1) FILE SECTION or
  497.           (2) WORKING-STORAGE SECTION or
  498.           (3) LINKAGE SECTION or
  499.           (4) COMMUNICATION SECTION or
  500.           (5) REPORT SECTION
  501. I = FILE SECTION found but is not followed by an FD, SD, RD statement.
  502. J = Invalid contents in A-Margin.
  503. K = PROCEDURE DIVISION not found or not in required location.
  504. L = Unbalanced quotes or missing sentence delimiters have caused composition
  505.     overset and loss of data - Data Division.
  506. M = Composition overset caused by over-length procedure (paragraph).
  507.  
  508. Composition Restrictions
  509. ------------------------
  510. (1)The Procedure Division is recomposed paragraph by paragraph (meaning named procedure). In the event a paragraph exceeds 10,000 characters it must be broken by the insertion  of   dummy paragraph names that can later be removed from the output program.   10,000  characters averages about 180 statements.
  511.  
  512. (2)No character string other than a literal or on a comment statement may exceed 56 characters. If such is encountered REWRITE will go into a loop attempting to reset to a non-existent previous interword gap.
  513.  
  514. Special Note
  515. ------------
  516. REWRITEn can be aborted by depressing the ESCAPE key. This will prove necessary if a loop occurs because of a missing quote symbol or other coding violation.
  517. INDENT CONTROL TABLE STRUCTURE
  518.  
  519.         01 INDENT-RECORD.
  520.             02 IR-PHRASE          PIC X(20).
  521.             02 IR-CTL-CODE        PIC X.
  522.             02 FILLER             PIC X.
  523.             02 IR-LENGTH          PIC 99.
  524.   
  525. PHRASE may contain one or more words beginning in the 2nd position. The 1st position must be blank (or contain an asterisk to be treated as a comment).
  526.  
  527. LENGTH must include the leading blank and the terminating delimiter (either a blank or a left parenthesis). Legal range: 03 - 20.
  528.  
  529. INDENT CONTROL CODES:
  530.  
  531. The System employs a maximum of five 4-byte indents beginning at the B-Margin. At the end of a sentence (occurrance of a period) the current indent is reset to the B-Margin.
  532.  
  533. Sentences are built word by word until either the right margin is reached and the sentence is continued at the next indent or there is a match against one of the words or phrases in the INDENT1 table, in which case the current line is immediately written out and the appropriate indent is set according to the following control codes:
  534.  
  535.  
  536.  1    Permanent shift to next indent except at beginning of a new sentence.
  537.  
  538.  2    Temporary shift of 2 bytes, insert word, write line, and set ELSE count.
  539.  
  540.  3    Temporary shift to next indent and set table pointer to INDENT2.
  541.  
  542.  4    Temporary shift to next indent.
  543.  
  544.  5    Temporary shift to next indent and set table pointer to INDENT1.
  545.  
  546.  6    Permanent shift to next indent except at beginning of new sentence
  547.       and add 1 to IF-counter.
  548.  
  549.  7    Temporary shift of 2 bytes, insert work/phrase, write line, and subtract 
  550.       1 from IF-counter.
  551.  
  552.  8    Begin new line at current indent.
  553.  
  554.  9    Permanent shift to next indent (until end of sentence).
  555.  
  556. ADDITIONAL COMPOSITION RESTRICTIONS
  557.  
  558. It is possible to recompose a portion of a program as long as all division headers are present.  This permits the recomposition of segments that may be extracted out into copy book members.
  559.  
  560. In all cases, there can be no missing periods or quote symbols.
  561.  
  562. There should be no EJECT statements in the A-Margin.
  563.  
  564. Sentences must be delimited by a period.  Long sentences will be presented in multiple lines, with an indent for continued lines separate from the indents caused by reserved words in the two indent tables.
  565.  
  566. Comments embedded within long sentences (such as nested IFs) will cause the indent structure to be restarted following such comments as if that portion was the beginning of a new sentence.  The program will compile OK, but its appearance will be degraded.
  567.  
  568. Comment lines should be preceeded and followed by spacer lines with asterists in column 7 because the REWRITE programs emit spacer lines only ahead of 01 level data names in the Data Division and ahead of paragraph names in the Procedure Division.
  569.  
  570. No Procedure Division-type statements (such as EXEC SQL) in the Data Division will be accepted.  They must either be commented before and restored afterward or replaced by COPY statements.
  571.  
  572. In the event the source program has comment headers in the following form ..
  573.  
  574.         ***************************************************************
  575.         *            P R O C E D U R E    D I V I S I O N             *
  576.         ***************************************************************
  577.  
  578.  ... they should immediately FOLLOW the relavant division heading, EXCEPT for the Identification Division.  Any such comment for the Identification Division statement must PRECEDE it.
  579.  
  580. Any large block of comment statements detailing maintenance history and other general information narratives appearing at the beginning of a program must appear AFTER the REMARKS statement.
  581.